package controle;

import junit.framework.Assert;

import org.junit.Test;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import br.edu.faeterjrio.entidade.Usuario;

public class UsuarioControleIT {
	
	@Test
	public void testObterUsuarioSucesso() {
		MultiValueMap<String, String> headers = new LinkedMultiValueMap<String,String>();
		headers.add("Accept", "application/json");
		HttpEntity<Object> requestEntity = new HttpEntity<Object>(headers);
		
		RestTemplate restClient = new RestTemplate();
		ResponseEntity<Usuario> responseEntity = 
				restClient.exchange("http://localhost:8080/backservices/usuarios/123", HttpMethod.GET, requestEntity, Usuario.class);
		Assert.assertEquals("123", responseEntity.getBody().getNomeAcesso());
	}
}
